package com.taobao.api.request;

import com.taobao.api.internal.util.RequestCheckUtils;
import java.util.Map;

import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.VideoUpdateResponse;
import com.taobao.api.ApiRuleException;
/**
 * TOP API: taobao.video.update request
 * 
 * @author auto create
 * @since 1.0, 2013-07-17 12:39:34
 */
public class VideoUpdateRequest implements TaobaoRequest<VideoUpdateResponse> {

	private Map<String, String> headerMap = new TaobaoHashMap();
	private TaobaoHashMap udfParams; // add user-defined text parameters
	private Long timestamp;

	/** 
	* 视频封面url,不能超过512个英文字母
	 */
	private String coverUrl;

	/** 
	* 视频描述信息，不能超过256个汉字
	 */
	private String description;

	/** 
	* 视频标签，以','隔开，且总长度不超过128个汉字
	 */
	private String tags;

	/** 
	* 视频标题，不超过128个汉字。title, tags,cover_url和description至少必须传一个
	 */
	private String title;

	/** 
	* 在淘宝视频中的应用key，该值向淘宝视频申请产生
	 */
	private Long videoAppKey;

	/** 
	* 视频id
	 */
	private Long videoId;

	public void setCoverUrl(String coverUrl) {
		this.coverUrl = coverUrl;
	}
	public String getCoverUrl() {
		return this.coverUrl;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	public String getDescription() {
		return this.description;
	}

	public void setTags(String tags) {
		this.tags = tags;
	}
	public String getTags() {
		return this.tags;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	public String getTitle() {
		return this.title;
	}

	public void setVideoAppKey(Long videoAppKey) {
		this.videoAppKey = videoAppKey;
	}
	public Long getVideoAppKey() {
		return this.videoAppKey;
	}

	public void setVideoId(Long videoId) {
		this.videoId = videoId;
	}
	public Long getVideoId() {
		return this.videoId;
	}

	public Long getTimestamp() {
		return this.timestamp;
	}

	public void setTimestamp(Long timestamp) {
		this.timestamp = timestamp;
	}

	public String getApiMethodName() {
		return "taobao.video.update";
	}

	public Map<String, String> getTextParams() {		
		TaobaoHashMap txtParams = new TaobaoHashMap();
		txtParams.put("cover_url", this.coverUrl);
		txtParams.put("description", this.description);
		txtParams.put("tags", this.tags);
		txtParams.put("title", this.title);
		txtParams.put("video_app_key", this.videoAppKey);
		txtParams.put("video_id", this.videoId);
		if(this.udfParams != null) {
			txtParams.putAll(this.udfParams);
		}
		return txtParams;
	}

	public void putOtherTextParam(String key, String value) {
		if(this.udfParams == null) {
			this.udfParams = new TaobaoHashMap();
		}
		this.udfParams.put(key, value);
	}

	public Class<VideoUpdateResponse> getResponseClass() {
		return VideoUpdateResponse.class;
	}

	public void check() throws ApiRuleException {
		RequestCheckUtils.checkMaxLength(coverUrl,512,"coverUrl");
		RequestCheckUtils.checkMaxLength(description,512,"description");
		RequestCheckUtils.checkMaxListSize(tags,25,"tags");
		RequestCheckUtils.checkMaxLength(tags,256,"tags");
		RequestCheckUtils.checkMaxLength(title,256,"title");
		RequestCheckUtils.checkNotEmpty(videoAppKey,"videoAppKey");
		RequestCheckUtils.checkNotEmpty(videoId,"videoId");
	}

	public Map<String, String> getHeaderMap() {
		return headerMap;
	}
}
